package br.sgpweb.utils;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;


public class Fabrica {
	private static EntityManagerFactory factory;
	private static EntityManager manager;
		
	private static void CriarSessao(){		
		try 
		{
			factory = Persistence.createEntityManagerFactory("monografia");
			manager = factory.createEntityManager();

		} catch (Exception e) {
			System.out.println("Erro ao salvar: " + e.getMessage());
		}		
	}
	
	public static EntityManager getManagerFactory(){
		Fabrica.CriarSessao();
		return manager;
	}

}








